local Ribenren = fk.CreateSkill {
    name = "Ribenren",
    anim_type = "defensive",
    tags = {Skill.Compulsory},
}

Fk:loadTranslationTable{
  ["Ribenren"] = "我是日本人",
  ["$Ribenren1"] = "日本语1",
  ["$Ribenren2"] = "日本语2",
  [":Ribenren"] = "锁定技，当你受到伤害后，你失去10点体力并随机获得一个技能直到本轮结束。",
}



-- 当受到伤害后触发
Ribenren:addEffect(fk.Damaged, {
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(Ribenren.name) and target == player
  end,
  
  on_use = function(self, event, target, player, data)
    local room = player.room
    local kingdom_skills = {}
    room:loseHp(player, 10)
    local round = room.logic:getCurrentEvent():findParent(GameEvent.Round)
    if round ~= nil then
        for name, general in pairs(Fk.generals) do
            for _, skill_name in ipairs(general:getSkillNameList()) do
                if not skill_name:startsWith("#") and not skill_name:endsWith("&") and not player:hasSkill(skill_name) then
                    table.insertIfNeed(kingdom_skills, skill_name)
                end
            end
        end
        local skill = kingdom_skills[math.random(1, #kingdom_skills)]
        room:handleAddLoseSkills(player, skill, nil)
        round:addCleaner(function()
          room:handleAddLoseSkills(player, "-" .. skill, nil)
        end)
    end
  end,
})



return Ribenren 